package com.first.mapper;

import com.first.entity.SubjectEntity;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SubjectMapper{

    @Select("select * from subject")
    List<SubjectEntity> getSubjectList();

    @Update("update subject set subjectname=#{subjectName},subjectinfo=#{subjectInfo},credit=#{credit} where id=#{id}")
    int updateSubject(@Param("subjectName") String subjectName,@Param("subjectInfo") String subjectInfo,@Param("credit") Integer credit,@Param("id") Integer id);

    @Delete("delete from subject where id=#{id}")
    int deleteSubject(@Param("id") Integer id);

    @Insert("insert into subject values(null,#{subjectName},#{subjectInfo},#{credit})")
    int insertSubject(@Param("subjectName") String subjectName,@Param("subjectInfo") String subjectInfo,@Param("credit") Integer credit);

}
